package common_models

import (
	"gitee.com/xlizy/common-go/base/xtime"
)

type ControlBy struct {
	CreatorId  string `json:"creatorId" gorm:"column:creator_id;index;comment:创建者"`
	ModifierId string `json:"modifierId" gorm:"column:modifier_id;index;comment:更新者"`
}

// SetCreatedBy 设置创建人id
func (e *ControlBy) SetCreatedBy(creatorId string) {
	e.CreatorId = creatorId
}

// SetUpdatedBy 设置修改人id
func (e *ControlBy) SetUpdatedBy(modifierId string) {
	e.ModifierId = modifierId
}

type PrimaryKey struct {
	Id string `json:"id" gorm:"column:id;primaryKey;comment:主键编码" url:"id"`
}

// SetPrimaryKey 主键
func (e *PrimaryKey) SetPrimaryKey(primaryKey string) {
	e.Id = primaryKey
}

type ModelTime struct {
	CreateTime   xtime.Time `json:"createTime" gorm:"column:create_time;comment:创建时间"`
	ModifiedTime xtime.Time `json:"modifiedTime" gorm:"column:modified_time;comment:最后更新时间"`
}

//type ActiveRecord interface {
//	schema.Tabler
//	SetCreateBy(createBy int64)
//	SetModifyBy(modifyBy int64)
//	Generate() ActiveRecord
//	GetId() interface{}
//}
